package org.example.Conrtoller;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author : zhangbo
 * @data : 2024/8/5
 * @description :
 */
public class AAAA {
    public static void main(String[] args) {
        String name="张三天,李四光,王无尽,赵六狗毛，张是的是的是的是的";
        List<String> list = Arrays.asList(name);
        System.out.println(list.size());
        // 使用Stream的map方法来处理每个人名
        String desensitizedNames = Arrays.asList(name.split(","))
                .stream()
                .map(nameItem -> nameItem.replaceAll("(\\w{1}).*", "$1*"))
                .collect(Collectors.joining(","));

        List<Object> collect = Arrays.asList(name.split(","))
                .stream()
                .map(nameItem -> {
                    if (nameItem.length() > 1) {
                        nameItem.replaceAll(nameItem, "*").indexOf(1);
                    }
                    return null;
                }).collect(Collectors.toList());

        System.out.println(collect.toString());
        System.out.println(desensitizedNames);
    }

    }

